#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
const int MAXN = 1e5+7;
multiset<int> Find;
struct work{
    int x, y;
};
work W[MAXN];
bool cmp(work a, work b) {
    if (a.y != b.y) return a.y > b.y;
    return a.x > b.x;
}
work M[1007];
int main(int argc, char** argv) {
#ifdef hai
    freopen("in.txt", "r", stdin);
#endif
    int n,m;
    cin>>n>>m;
    int x,y;
    for (int i=0; i<n; ++i) {
        scanf("%d %d", &x, &y);
        M[i].x = y;
        M[i].y = x;
    }
    for (int i=0; i<m; ++i) {
        scanf("%d %d", &x, &y);
        W[i].x = y;
        W[i].y = x;
    }
    sort(W, W+m, cmp);
    sort(M, M+n, cmp);
    int res_cnt = 0;
    long long res = 0;
    Find.clear();
    int st = 0;
    for (int i=0; i<m; ++i) {
        x = W[i].x;
        y = W[i].y;
        while (M[st].y>=y) {
            Find.insert(M[st].x);
            ++st;
        }
        set<int>::iterator mark = lower_bound(Find.begin(), Find.end(), x);
        if (mark != Find.end()) {
            ++res_cnt;
            res += 200*x + 3*y;
            Find.erase(mark);
        }
    }
    cout<<res_cnt<<" "<<res<<endl;
    return 0;
}
